// import count from '@feidao/web/atom/nodejs/db/count';
import query from '@dfeidao/atom-nodejs/db/query';


interface Message {
	filter: {};
}
interface Data {
	role_type_id: string;
}
// 查询数据(角色)
export default async function atom(msg: Message, action_id: string, session_id: string, spaceid: string) {

	const systemid = '12';
	const { exec, prepare } = query(action_id, session_id, systemid);

	prepare('pub_role', ['role_name', 'role_no', 'role_type_id', 'productid', 'icon', 'create_time'], msg.filter, 200, 1, [], []);
	const [data] = await exec<Data>();

	const role_t_id = data[0].role_type_id;

	// debugger
	// const { exec, prepare } = query(action_id, session_id, spaceid, systemid);
	prepare('pub_role_type', ['_id', 'role_type_name', 'tablename', 'field', 'fieldtitle', 'search_field', 'search_title', 'modelid', 'systemid', 'productid'], { _id: role_t_id }, 200, 1, [], []);
	const [data2] = await exec();
	// console.log(data,data2)
	return data2;
}
